package loengud.kymnes;

import java.awt.Graphics;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JFrame;

public class Liigutamine extends JFrame {

//	int[] x = new int[] {10, 100};
//	int[] y = new int[] {10, 100};
	
	static List<Point> points = new ArrayList<Point>();
	
	public static void main(String[] args) {
		Liigutamine l = new Liigutamine();
		
		l.addMouseMotionListener(new MouseAdapter() {
			
			Point start = null;
			
			@Override
			public void mousePressed(MouseEvent e) {
				Point point = e.getPoint();
				
				boolean selected = false;
				for (Point p : points) {
					double dist = point.distanceSq(p);
					if (dist < 10) {
						selected = true;
					}
				}
			}
			
			@Override
			public void mouseReleased(MouseEvent e) {
				Point to = e.getPoint();
				int dx = start.x - to.x;
				int dy = start.y - to.y;
				
				points  = new ArrayList<Point>(points);
			}
		}); // -addMouseMotionListener
	}
	
	@Override
	public void paint(Graphics g) {
		super.paint(g);
	}
}
